//
//  XYLBaseRequest.h
//  AFNet-3.0
//
//  Created by 夏玉林 on 16/7/11.
//  Copyright © 2016年 夏玉林. All rights reserved.
//



#import "BaseModel.h"


#define FLT_APP_WINDOW  [[UIApplication sharedApplication] keyWindow]

#define TOAST_LONG  2000
#define TOAST_SHORT 1000

#define kCBToastPadding         20
#define kCBToastMaxWidth        220
#define kCBToastCornerRadius    5.0
#define kCBToastFadeDuration    0.5
#define kCBToastTextColor       [UIColor whiteColor]
#define kCBToastBottomPadding   30


// iOS版本
#pragma mark - 判断ios9以上设备
#define IOS9_DEVICE  [[[UIDevice currentDevice]systemVersion] floatValue] >= 9.0
#pragma mark - 判断ios8以上设备
#define IOS8_DEVICE  [[[UIDevice currentDevice]systemVersion] floatValue] >= 8.0
#pragma mark - 判断ios7以上设备
#define IOS7_DEVICE  [[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0
#pragma mark - 判断ios6以上设备
#define IOS6_DEVICE  [[[UIDevice currentDevice]systemVersion] floatValue] >= 6.0


typedef void (^returnBlockType)(NSError * error,id obj);


typedef void (^returnBlockNetWork)(NSInteger netWork);




@interface XYLBaseRequest : BaseModel

@property (nonatomic,copy)returnBlockNetWork block;

/*
 *  单例(直接用于全局)
 */
+ (XYLBaseRequest *)RequestGlobal;

/*
 *  检查是否有网络 (如果返回结果是 1 网络异常)
 */
- (void )CheckNetStatus;

/*
 *  Get请求
 */
-(void)GetRequesetWithURL:(NSString *)url andParameters:(NSDictionary *)parameters completion:(returnBlockType)block;

/*
 *   网络请求通用方法的设置
 */
- (AFHTTPSessionManager *)RequestCommonMethodSet;

/*
 *  Post请求
 */
- (void)PostRequestWithURL:(NSString *)url andParams:(NSDictionary *)parameters completion:(returnBlockType)block;

/*
 *   停止所有网络请求
 */

+ (void)cancelAllOperation;

/*
 *   参数拼接方法 （这个根据不同的app 参数请求定义进行相应修改）
 */
- (NSDictionary *)DictWithFunction:(NSString *)functionName AndWithparma:(NSString *)string;


@end
